home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / tur_c_tu.arc / SOURCE.ARC / READCHAR.C < prev    next >
C/C++ Source or Header  |  1989-04-01  |  480b  |  20 lines

  1.                                          /* Chapter 10 - Program 3 */
  2. #include "stdio.h"
  3.  
  4. main()
  5. {
  6. FILE *funny;
  7. char c;
  8.  
  9.    funny = fopen("TENLINES.TXT","r");
  10.  
  11.    if (funny == NULL) printf("File doesn't exist\n");
  12.    else {
  13.       do {
  14.          c = getc(funny);    /* get one character from the file */
  15.          putchar(c);         /* display it on the monitor       */
  16.       } while (c != EOF);    /* repeat until EOF (end of file)  */
  17.    }
  18.    fclose(funny);
  19. }
  20.